package operation;


import book.Book;
import book.BookList;

import java.util.Scanner;

public class Return implements IOperation{
    public void work(BookList bookList){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你要借阅的书籍:");
        String name = scanner.nextLine();

        int cur = bookList.getUsedSize();
        for (int i = 0; i < cur; i++) {
            Book book = bookList.getBookList(i);
            if(book.getName().equals(name)) {
                book.setBorrowed(true);
                System.out.println("归还成功!归还书籍信息如下:");
                System.out.println(book);
                return;
            }
        }
        System.out.println("归还失败失败!");
    }
}
